package com.lrs.java.j2se_self.thread;

public class TestThreadJoin {
	public static void main(String[] args){
		MyThread t1 = new MyThread("myname");
		t1.start();
		try{
			t1.join();
		}catch(InterruptedException e){
	
		}
		for(int i=0;i<10;i++){
			System.out.println("The main Thread"+" "+ i);
		}
	}
}

class MyThread extends Thread{
	MyThread(String s){
		super(s);
	}
	public void run(){
		for(int i=0;i<10;i++){
			System.out.println(getName());
			try{
				sleep(1000);
			}catch(InterruptedException e){
				return;
			}
		}
	}
}
